﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Playables.PlayableBinding
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.ComponentModel;
using UnityEngine.Bindings;

#nullable disable
namespace UnityEngine.Playables
{
  /// <summary>
  ///   <para>Struct that holds information regarding an output of a PlayableAsset.</para>
  /// </summary>
  public struct PlayableBinding
  {
    private string m_StreamName;
    private UnityEngine.Object m_SourceObject;
    private System.Type m_SourceBindingType;
    private PlayableBinding.CreateOutputMethod m_CreateOutputMethod;
    /// <summary>
    ///   <para>A constant to represent a PlayableAsset has no bindings.</para>
    /// </summary>
    public static readonly PlayableBinding[] None = new PlayableBinding[0];
    /// <summary>
    ///   <para>The default duration used when a PlayableOutput has no fixed duration.</para>
    /// </summary>
    public static readonly double DefaultDuration = double.PositiveInfinity;

    /// <summary>
    ///   <para>The name of the output or input stream.</para>
    /// </summary>
    public string streamName
    {
      get => this.m_StreamName;
      set => this.m_StreamName = value;
    }

    /// <summary>
    ///   <para>A reference to a UnityEngine.Object that acts a key for this binding.</para>
    /// </summary>
    public UnityEngine.Object sourceObject
    {
      get => this.m_SourceObject;
      set => this.m_SourceObject = value;
    }

    /// <summary>
    ///   <para>The type of target required by the PlayableOutput for this PlayableBinding.</para>
    /// </summary>
    public System.Type outputTargetType => this.m_SourceBindingType;

    [EditorBrowsable(EditorBrowsableState.Never)]
    [Obsolete("sourceBindingType is no longer supported on PlayableBinding. Use outputBindingType instead to get the required output target type, and the appropriate binding create method (e.g. AnimationPlayableBinding.Create(name, key)) to create PlayableBindings", true)]
    public System.Type sourceBindingType
    {
      get => this.m_SourceBindingType;
      set
      {
      }
    }

    /// <summary>
    ///   <para>The type of the output or input stream.</para>
    /// </summary>
    [EditorBrowsable(EditorBrowsableState.Never)]
    [Obsolete("streamType is no longer supported on PlayableBinding. Use the appropriate binding create method (e.g. AnimationPlayableBinding.Create(name, key)) instead.", true)]
    public DataStreamType streamType
    {
      get => DataStreamType.None;
      set
      {
      }
    }

    internal PlayableOutput CreateOutput(PlayableGraph graph)
    {
      return this.m_CreateOutputMethod != null ? this.m_CreateOutputMethod(graph, this.m_StreamName) : PlayableOutput.Null;
    }

    [VisibleToOtherModules]
    internal static PlayableBinding CreateInternal(
      string name,
      UnityEngine.Object sourceObject,
      System.Type sourceType,
      PlayableBinding.CreateOutputMethod createFunction)
    {
      return new PlayableBinding()
      {
        m_StreamName = name,
        m_SourceObject = sourceObject,
        m_SourceBindingType = sourceType,
        m_CreateOutputMethod = createFunction
      };
    }

    [VisibleToOtherModules]
    internal delegate PlayableOutput CreateOutputMethod(PlayableGraph graph, string name);
  }
}
